package com.ecar.apm.model;

import com.alibaba.fastjson.JSON;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class HttpSequence {

	private static final Logger LOGGER = LoggerFactory.getLogger(HttpSequence.class);
	  private int id;
	  private String guid;
	  private String group;
	  private MonitorType  type;
	  private String name;
	  
	  public static HttpSequence getHttpSequence(HttpRequestForm httpRequestForm)
	  {
	    HttpSequence h = new HttpSequence();
	    h.setGuid(httpRequestForm.getPguid());
	    h.setGroup(httpRequestForm.getGroup());
	    h.setType(httpRequestForm.getType());
	    h.setName(httpRequestForm.getName());
	    h.setFrequency(httpRequestForm.getFrequency());
	    h.setRemark(httpRequestForm.getRemark());
	    
	    LOGGER.info("HttpSequence- h:" + JSON.toJSONString(h));
	    
	    return h;
	  }
	  
	  public enum MonitorType {
			SINGLE, SEQUENCE
		}    
	  
	  private MonitorFrequency frequency = MonitorFrequency.THIRTY;
	  private String variableResult;
	  private String remark;
	  private List<HttpRequest> httpRequest;
	  private HashMap<String, String> variableResultMap = new HashMap();
	  private String jobName;
	  private boolean enabled;
	  private boolean archived;
	  private Date createTime;
	  
	  public String getName()
	  {
	    return this.name;
	  }
	  
	  public void setName(String name)
	  {
	    this.name = name;
	  }
	  
	  public String getRemark()
	  {
	    return this.remark;
	  }
	  
	  public void setRemark(String remark)
	  {
	    this.remark = remark;
	  }
	  
	  public List<HttpRequest> getHttpRequest()
	  {
	    return this.httpRequest;
	  }
	  
	  public void setHttpRequest(List<HttpRequest> httpRequest)
	  {
	    this.httpRequest = httpRequest;
	  }
	  
	  public HashMap<String, String> getVariableResultMap()
	  {
	    return this.variableResultMap;
	  }
	  
	  public void setVariableResultMap(HashMap<String, String> variableResultMap)
	  {
	    this.variableResultMap = variableResultMap;
	  }
	  
	  public int getId()
	  {
	    return this.id;
	  }
	  
	  public void setId(int id)
	  {
	    this.id = id;
	  }
	  
	  public String getGuid()
	  {
	    return this.guid;
	  }
	  
	  public void setGuid(String guid)
	  {
	    this.guid = guid;
	  }
	  
	  public String getGroup()
	  {
	    return this.group;
	  }
	  
	  public void setGroup(String group)
	  {
	    this.group = group;
	  }
	  
	  public String getVariableResult()
	  {
	    return this.variableResult;
	  }
	  
	  public void setVariableResult(String variableResult)
	  {
	    this.variableResult = variableResult;
	  }
	  
	  public MonitorType  getType()
	  {
	    return this.type;
	  }
	  
	  public void setType(MonitorType  type)
	  {
	    this.type = type;
	  }
	  
	  public MonitorFrequency getFrequency()
	  {
	    return this.frequency;
	  }
	  
	  public void setFrequency(MonitorFrequency frequency)
	  {
	    this.frequency = frequency;
	  }
	  
	  public String getJobName()
	  {
	    return this.jobName;
	  }
	  
	  public void setJobName(String jobName)
	  {
	    this.jobName = jobName;
	  }
	  
	  public boolean isEnabled()
	  {
	    return this.enabled;
	  }
	  
	  public void setEnabled(boolean enabled)
	  {
	    this.enabled = enabled;
	  }
	  
	  public Date getCreateTime()
	  {
	    return this.createTime;
	  }
	  
	  public void setCreateTime(Date createTime)
	  {
	    this.createTime = createTime;
	  }
	  
	  public boolean isArchived()
	  {
	    return this.archived;
	  }
	  
	  public void setArchived(boolean archived)
	  {
	    this.archived = archived;
	  }
	  
	  public static String getMonitorTypeName(String type)
	  {
	    return "SEQUENCE".equals(type) ? "多API" : "单API";
	  }
}
